from typing import List


class Solution:
    def evalRPN(self, tokens: List[str]) -> int:
        stack = []
        for token in tokens:
            if token in "+-*/":
                res = int(eval(f"{stack[-2]}{token}{stack[-1]}"))
                stack.pop()
                stack.pop()
                stack.append(res)
            else:
                stack.append(token)
        return stack[0]


if __name__ == '__main__':
    s = Solution()
    r = s.evalRPN(["2", "1", "+", "3", "*"])
    print(r)
